/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;

import java.io.IOException;
import org.prevayler.Prevayler;

public class SnapshotTimer extends Thread {

    Prevayler prevayler;

    public SnapshotTimer(Prevayler prevayler) {
        this.prevayler = prevayler;
        this.setDaemon(true);
    }

    @Override
    public void run() {
        //super.start();
        while (true) {
            try {
                Thread.sleep(1000 * 60 * 30); //6 horas  
                prevayler.takeSnapshot();
                //System.out.println("Snapshot disparado as " + new java.util.Date() + "...");
            } catch (InterruptedException e) {
                //e.printStackTrace();
            } catch (IOException e) {
                //e.printStackTrace();
            }
        }
    }
}
